﻿using System;
class TheMatrix
{
    static void Main()
    {
        int number;
        Console.Write("Please enter matrix size: ");
        do
        {
            while (true)
            {
                try
                {
                    number = int.Parse(Console.ReadLine());
                    break;
                }
                catch (Exception)
                {
                    Console.Write("Please re-enter size: ");
                }
            }
        } while ((number <= 0) || (number > 20));
        Console.WriteLine(number);
        Console.ReadLine();
        for (int k = 1; k <= number; k++)
        {
            for (int i = k; i <= (number + (k - 1)); i++)
            {
                if (i != number + (k - 1))
                {
                    Console.Write("| {0,-2}", i);
                }
                else
                {
                    Console.WriteLine("| {0,-2}|", i);
                }
            }
        }
        Console.ReadLine();
    }
}

